Re: [SQL] optimizing 2-table join w/millions of rows

Поиск
Список
Период
Сортировка
Искать
От
Herouth Maoz
Тема
Re: [SQL] optimizing 2-table join w/millions of rows
Дата
Msg-id
l03110700b27da28b94ff@[147.233.159.109]
Ответ на
Список
Дерево обсуждения
optimizing 2-table join w/millions of rows Michael Olivier <molivier@yahoo.com>
Re: [SQL] optimizing 2-table join w/millions of rows Herouth Maoz <herouth@oumail.openu.ac.il>
At 4:26 +0200 on 20/11/98, Michael Olivier wrote:


>
> select U.acctname from usertest U, bgndtest B where
> 	B.part_needed=3 and B.loc_needed=5 and
> 	B.acctname=U.acctname and U.acctname in
> 		(select acctname from usertest where part=2 and loc=3)

Can you explain *verbally* what you meant to do here? It seems as if the
subselect is redundant. How about:

SELECT U.acctname
FROM   usertest U, bgndtest B
WHERE  B.acctname = U.acctname
  AND  B.part_needed=3 AND B.loc_needed=5
  AND  U.part=2 AND U.loc=3;

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma


В списке pgsql-sql по дате отправления
От: Tom Lane
Дата:
От: Postgres DBA
Дата:
FAQ